#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Copyright © 启明星辰 版权所有
# @Time    : 2023/4/12 12:07
# @Author  : 胡浩浩
# @Email   : hu_haohao@venusgroup.com.cn
# @File    : menus.py
# @IDE     : PyCharm
# @description :
from pywebio import config
from pywebio.output import *
from pywebio.output import clear_scope
from pywebio.session import eval_js


def show_menus():
    """
    菜单

    :return:
    """
    # 设置footer
    eval_js('window.document.querySelector("footer").textContent = "Powered by Huhaohao";')
    clear_scope("menus")
    clear_scope("data_list")
    put_row(
        [
            put_scrollable(put_scope("menus"), height=1000).style("background:#fbfcfe"),
            None,
            put_scrollable(put_scope("data_list"), height=1000).style("background:#fbfcfe"),
        ], size="10% 1%"
    )
    put_grid([
        [ put_html("<h3>策马奔腾测试平台</h3>")],
        [
            put_collapse("\U0001F4D3用例管理", [
                put_column([
                    # put_link("用例列表", "/case_list"),
                    # put_link("用例分组", "/case_group"),
                    put_link("用例转化", "/case_convert"),
                    # put_link("附件上传", "/attachment_upload"),
                    # put_link("用例升级", "/case_update"),
                ])

            ], open=True)
        ],
        [
            put_collapse("\U0001F916自动化测试", [
                put_column([
                    put_link("登录模板", "/login_manage"),
                    put_link("用例执行", "/case_exec"),
                    # put_link("定时任务", "/menus"),
                ])
            ], open=True)
        ],
        # [
        #     put_collapse("\U0001F916性能测试", [
        #         put_column([
        #             # put_link("前置后置", "/menus"),
        #             put_link("接口测试", "/api_test"),
        #             # put_link("用例执行", "/case_exec"),
        #             # put_link("定时任务", "/menus"),
        #         ])
        #     ], open=True)
        # ],
        [
            put_collapse("\U0001F4CA测试报告", [
                put_column([
                    put_link("报告列表", "/reports_list"),
                ])
            ], open=True)
        ],
        [
            put_collapse("\U0001F5A5系统管理", [
                put_column([
                    put_link("环境管理", "/show_environment"),
                    # put_link("任务管理", "/show_task"),
                    put_link("服务器管理", "/show_server"),
                ])
            ], open=True)
        ],
        [
            put_collapse("\U0001F6E0工具箱", [
                put_column([
                    put_link("接口测试", "/api_test"),
                    put_link("全局变量", "/variables"),
                    put_link("内置函数", "/show_func"),
                    put_link("数据提取", "/data_extract"),
                    put_link("加密解密", "/data_encode"),
                    put_link("ChatGPT", "/chartgpt"),
                ])
            ], open=True)
        ]
    ], scope="menus")

